jQ(document).ready(function(){
	var dropdowntimeout;
	var obj;
	jQ('.dropdown-toggle').live('mouseenter',function(){
		if(obj != jQ(this) || typeof(obj) != "undefined"){
			closeDropdownMenu();
			obj = jQ(this);
		}else{
			obj = jQ(this);
		}
		if(dropdowntimeout)clearTimeout(dropdowntimeout);
		if(jQ(this).attr('id') == 'boardbox'){
			jQ(this).addClass('on');
		}else{
			jQ(this).parent().addClass('on');
		}
		jQ(this).siblings('.dropdown-menu').show();
	})
	jQ('.dropdown-toggle').live('mouseleave',function(){
		if(jQ(this).attr('id') != 'tologin'){
			dropdowntimeout = setTimeout(closeDropdownMenu,300);
		}else{
			dropdowntimeout = setTimeout(closeDropdownMenu,1000);
		}
	})
	jQ('.dropdown-menu').live('mouseenter',function(){
		if(dropdowntimeout)clearTimeout(dropdowntimeout);
	})
	jQ('.dropdown-menu').live('mouseleave',function(){
		if(jQ(this).attr('id') != 'tologinshow'){
			dropdowntimeout = setTimeout(closeDropdownMenu,300);
		}else{
			dropdowntimeout = setTimeout(closeDropdownMenu,1000);
		}
	})
		function closeDropdownMenu(){
		if(typeof(obj) != "undefined" ){
			if(obj.attr('id') == 'boardbox'){
				jQ('.dropdown-toggle').removeClass('on');
			}else{
				jQ('.dropdown-toggle').parent().removeClass('on');
			}
			jQ('.dropdown-menu').hide();
		}
	}
});	